#!/usr/bin/php -c /home/awilliam/workspace/pogi/docs/demos

<?PHP

   ini_set("include_path", ".:/usr/share/php:/home/awilliam/workspace/pogi/source");

   function error($n, $m, $f, $l){
     print_r(debug_backtrace());
   }
   
  set_error_handler('error');

  // Include The File
  include("OGoTask.inc");

  // Create The Server Object - hostname, uri, port number
  $server = new OGoServer("kohocton", "/RPC2", 80);

  // Set you user credentials - username, password

  $server->login("adam", "********");

  // Create A Task Manager Object
  $taskManager = new OGoTaskManager($server);

  // Ask the Task Manager for all my delegated tasks
  $task = $taskManager->getTask("68890");

  print "------------------------------------------------\n";
  print "ID: " . $task->getId() . "\n";
  print "------------------------------------------------\n";
  print "Name: " . $task->getName() . "\n";
  print "Start Date: " . $task->getStartDate() . "\n";
  print "End Date: " . $task->getEndDate() . "\n";
  print "Team Job: " . $task->getIsTeamJob() . "\n";
  print "Keywords: " . $task->getKeyWords() . "\n";
  print "Status: " . $task->getVanityStatus() . "\n";
  print "Priority: " . $task->getVanityPriority() . "\n";
  print "Creator: " . $task->getCreatorLogin() . "\n";
  print "Executor: " . $task->getExecutorCN() . "\n";
  print "Version: " . $task->getVersion() . "\n";
  print "\n";

  $history = $task->getHistory();

  for ($i = 0; $i < count($history); $i++) {
    print "------------------------------------------------\n";
    print "Action: " . $history[$i]->getAction() . "\n";
    print "Date: : " . $history[$i]->getActionDate() . "\n";
    print "Status: " . $history[$i]->getStatus() . "\n";
    print "Comment: " . $history[$i]->getComment() . "\n";
   }

?>
